package com.dct.activity.board;

import java.util.ArrayList;
import java.util.List;

import com.dct.activity.R;
import com.dct.dao.BoardDTO;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import android.view.View;

public class BoardListAdapter extends BaseAdapter{
	private LayoutInflater mInflater;
	private List<BoardDTO> mRowList;
	private int resourceLayoutId;
	
	public BoardListAdapter(Context context, int textViewResourceId, List<BoardDTO> mRowList2)
	{
		mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		resourceLayoutId = textViewResourceId;
		mRowList = mRowList2;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView == null)
		{
			convertView = mInflater.inflate(resourceLayoutId, parent, false);
		}
		
		TextView subject = (TextView) convertView.findViewById(R.id.subject);
		subject.setText(mRowList.get(position).getSubject());
		
		TextView writer = (TextView) convertView.findViewById(R.id.writer);
		writer.setText(mRowList.get(position).getWriter());
		
		TextView wdate = (TextView) convertView.findViewById(R.id.wdate);
		wdate.setText(mRowList.get(position).getWdate());
		
		return convertView;
	}	

	@Override
	public int getCount()
	{
		return mRowList.size();
	}

	@Override
	public Object getItem(int position)
	{
		return mRowList.get(position);
	}

	@Override
	public long getItemId(int position)
	{
		return position;
	}

	
	
}
